package com.aaa.ps.controller;

import com.aaa.common.entity.Menu;
import com.aaa.ps.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("menu")
public class MenuController{

    @Autowired
    private MenuService menuService;


    //根据id删除
    @DeleteMapping("deleteByPrimaryKey")
    public int deleteByPrimaryKey(Integer menuId) {
        //修改代码
        System.out.println("这里是修改代码显示");
        //完善了扫描
        System.out.println("完善了MenuController");
        //添加了神马功能
        System.out.println("其实没加啥");
        return menuService.deleteByPrimaryKey(menuId);
    }

    //添加
    @PostMapping("insertSelective")
    public int insertSelective(@RequestBody Menu record) {
        return menuService.insertSelective(record);
    }

    //跟据id查询
    @GetMapping("selectByPrimaryKey")
    public Menu selectByPrimaryKey(Integer menuId) {
        return menuService.selectByPrimaryKey(menuId);
    }

    //更新
    @PutMapping("updateByPrimaryKeySelective")
    public int updateByPrimaryKeySelective(@RequestBody Menu record) {
        return menuService.updateByPrimaryKeySelective(record);
    }

    //列表查询
    @GetMapping("selectAll")
    public List<Menu> selectAll() {
        return menuService.selectAll();
    }
}
